<extend name="Public/user"/>
<block name="user-right">
	<script type="text/javascript" src="__STATIC__/thinkbox/thinkbox/jquery.thinkbox.js"></script>
	<script type="text/javascript" src="__JS__/style.js"></script>
	<style>
		.num{margin-left: 3px ;margin-right: 3px;color: #AB263C;}
		.current{color: #AB263C;}
	</style>
	<!--main_right-->
	<div class="main_r f_fr" style="position:relative;">
		<div class="user_kx">
			<h3 class="user_kx_title">
				{:lang('order_list')}

			</h3>
		</div>
		<div style="position: absolute;top: 90px;right: 30px;width: 200px;height: 29px;">
			<form action="{:url('User/dingdan','status='.$_GET['status'])}" method="get">
				<input type="text" name="keywords" value="<?php echo isset($_GET['keywords'])?$_GET['keywords']:'' ?>" style="width: 100px;margin-top: 2px;padding: 2px;" placeholder=""><input type="submit" value="{:lang('search')}" style="border: none;background: red;color:#fff;height: 27px;padding: 0 20px;">
			</form>
		</div>

		<div class="user_kx">

			<!-- Nav tabs -->
			<ul class="nav nav-tabs" role="tablist">
				<li role="presentation" class="<eq name="status" value="">active<else /></eq>"><a href="{:url('User/dingdan')}">{:lang('all')}</a></li>
				<li role="presentation" class="<eq name="status" value="1">active<else /></eq>"><a href="{:url('User/dingdan','status=1')}"  >{:lang('pending_confirm')}</a></li>
				<li role="presentation" class="<eq name="status" value="2">active<else /></eq>"><a href="{:url('User/dingdan','status=2')}"  >{:lang('pending_dabao')}</a></li>
				<li role="presentation" class="<eq name="status" value="3">active<else /></eq>"><a href="{:url('User/dingdan','status=3')}"   >{:lang('pending_pay')}</a></li>
				<li role="presentation" class="<eq name="status" value="4">active<else /></eq>"><a href="{:url('User/dingdan','status=4')}"   >{:lang('pending_shipped')}</a></li>
				<li role="presentation" class="<eq name="status" value="5">active<else /></eq>"><a href="{:url('User/dingdan','status=5')}"  >{:lang('pending_receipt')}</a></li>
				<li role="presentation" class="<eq name="status" value="6">active<else /></eq>"><a href="{:url('User/dingdan','status=6')}"   >{:lang('has_receipt')}</a></li>
				<li role="presentation" class="<eq name="status" value="10">active<else /></eq>"><a href="{:url('User/dingdan','status=10')}">撤销订单</a></li>
			</ul>

			<!-- Tab panes -->
			<div class="tab-content">
				<div role="tabpanel" class="tab-pane active" id="home">
					<table class="table table-striped table-bordered">

						<tbody>
						<tr >
							<th class="w70 ta_c" >{:lang('order_num')}</th>
							<th class="w100 ta_c">{:lang('delivery_info')}</th>
							<th class="w50 ta_c">{:lang('shipping_method')}</th>
							<th class="w50 ta_c">增值服务</th>
							<th class="w70 ta_c">{:lang('add_time')}</th>
							<th class="w70 ta_c">{:lang('remark')}</th>
							<th class="w70 ta_c">运费</th>
							<th class="w50 ta_c">{:lang('status')}</th>

						</tr>
						<if condition="$list">
							<volist name="list" id="v">
								<tr   style="<eq name='v.status' value='10'>background-color:#EDED98;</eq>">
									<td><a href="{:url('User/dingdanview','id='.$v['id'])}">{$v.sn}</a></td>
									<td>{$v.consignee} ({$v.tel})</td>
									<td>
									<lt name='v.id' value='1345'>
										{$v.deliveryid|get_delivery_name}
									<else/>
									{$v.transport_id|get_transport}({$v.transport_line_id|get_transport_line})
									</lt>
									</td>
									<td>
									<lt name='v.id' value='1345'>
										<eq name='v.fuwu_baojia' value='1'>保价&</eq>
										<eq name='v.fuwu_jiagu' value='1'>超级加固&</eq>
										<eq name='v.fuwu_jiagu' value='0'>简单加固&</eq>
										<eq name='v.fuwu_jiaji' value='1'>加急</eq>
									<else/>
									<php>if($v['increment'] && $increment = json_decode($v['increment'])){
									$increment_map['id'] = array('in',$increment);
									$temp = M('TransportIncrement')->where($increment_map)->select();
									
									if($temp){
									   
									   foreach($temp as $k=>$t){
									   		if($k==0){
									   		echo $t['name'];
									   		}else{
									   		echo '&'.$t['name'];
									   		}
									   	
									   }
									
									}
									
									}</php>
									</lt>
									
									
									</td>

									<td>{$v.addtime|date="Y-m-d",###}</td>
									<td>{$v.remark}</td>
									<td>{$v.freight}日元</td>
									<td>


										<elt name="v.status" value="3">
											{$v.status|getyundanstatus}
										</elt>
										<eq name="v.status" value="4">
											<eq name="v.payed" value="2">
												{:lang('part_daifa')}
												<else/>
												{$v.status|getyundanstatus}
											</eq>
										</eq>
										<eq name="v.status" value="5">
											<eq name="v.payed" value="2">
												{:lang('part_daishou')}
												<else/>
												{$v.status|getyundanstatus}
											</eq>
										</eq>
										<eq name="v.status" value="6">
											<eq name="v.payed" value="2">
												{:lang('part_shouhuo')}
												<else/>
												{$v.status|getyundanstatus}
											</eq>
										</eq>
										<eq name='v.applay_cancel' value='0'>
											<eq name="v.status" value="3">
												<a href="{:url('User/paydingdan','id='.$v['id'])}" style="display:inline-block;background: red;color: #fff;padding: 2px 2px;">{:lang('go_payment')}</a>
											</eq>
											<eq name="v.status" value="5">
												<a href="javascript:shouhuo({$v.id});" style="display:inline-block;background: red;color: #fff;padding: 2px 2px;margin-bottom: 2px;">{:lang('confirm_receipt')}</a>
												<eq name="v.payed" value="2">
													<a href="{:url('User/paydingdan','id='.$v['id'])}" style="display:inline-block;background: red;color: #fff;padding: 2px 2px;">{:lang('pay_yukuan')}</a>
												</eq>
											</eq>

											<eq name="v.status" value="4">
												<eq name="v.payed" value="2">
													<a href="{:url('User/paydingdan','id='.$v['id'])}" style="display:inline-block;background: red;color: #fff;padding: 2px 2px;">{:lang('pay_yukuan')}</a>
												</eq>
											</eq>
											<eq name="v.status" value="6">
												<!-- <a href="javascript:pingjia({$v.id});" style="display:inline-block;background: red;color: #fff;padding: 2px 2px;margin-bottom: 2px;">去评价</a> -->
												<eq name="v.payed" value="2">
													<a href="{:url('User/paydingdan','id='.$v['id'])}" style="display:inline-block;background: red;color: #fff;padding: 2px 2px;">{:lang('pay_yukuan')}</a>
												</eq>
											</eq>
										</eq>
										<eq name='v.status' value='10'>已撤销
										</eq>
										<eq name='v.status' value='1'><br>
											<a href="javascript:cancelDingdan({$v.id});"
											   style="display:inline-block;background: red;color: #fff;padding: 2px 2px;">
												撤销订单</a>
											<else/>
											<elt name='v.status' value='3'><br>
												<eq name='v.applay_cancel' value='0'>
													<a href="javascript:applayCancel({$v.id});"
													   style="display:inline-block;background: red;color: #fff;padding: 2px 2px;">
														申请撤销 </a>
													<else/>

													<a href="javascript:"
													   style="display:inline-block;background: red;color: #fff;padding: 2px 2px;">
														等待仓库处理</a>
											</elt>

										</eq>
										</eq>
									</td>
								</tr>
							</volist>
							<else />
							<tr>
								<td colspan="8">{:lang('no_infos')}</td>
							</tr>
						</if>

						</tbody>


					</table>
					<div style="word-spacing:5px; letter-spacing: 1px;">
						{$_page}

					</div>
				</div>


			</div>

		</div>
	</div>
</block>
<block name="javascript">
	<script type="text/javascript">
		function shouhuo(id){
			$.post("{:url('shouhuo')}",{'id':id},function(data){
				if (data.status) {
					$.thinkbox.success(data.info);
					setTimeout(jumpurl(data.url),1000);
				}else{
					$.thinkbox.error(data.info);
				};
			})
		}

		function cancelDingdan(id){
			if(confirm('确认要撤销订单？')){
				$.post("{:url('User/cancelDingdan')}",{'id':id},function(data){
					if (data.status) {
						$.thinkbox.success(data.info);
						setTimeout(jumpurl(data.url),2000);
					}else{
						$.thinkbox.error(data.info);
					};
				})
			}
		}


		function applayCancel(id){
			if(confirm("此时申请撤销订单在撤销成功之后会扣除{:config('APPLAY_CANCEL_PAY')}日元费用，点击确认申请！")){
				$.post("{:url('User/applayCancel')}",{'id':id},function(data){
					if (data.status) {
						$.thinkbox.success(data.info);
						setTimeout(jumpurl(data.url),2000);
					}else{
						$.thinkbox.error(data.info);
					};
				})
			}
		}


	</script>
</block>